package com.imooc.ecommerce.feign;

import com.imooc.ecommerce.common.TableId;
import com.imooc.ecommerce.goods.DeductGoodsInventory;
import com.imooc.ecommerce.goods.SimpleGoodsInfo;
import com.imooc.ecommerce.vo.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * 不安全的商品服务 feign接口
 * @author zhangshao
 * @since 2023/12/13 23:35
 */
@FeignClient(contextId = "NotSecuredGoodsClient",value = "e-commerce-goods-service")
public interface NotSecuredGoodsClient {

    /**
     * 根据ids查询简单的商品信息
     * @param deductGoodsInventories
     */
    @RequestMapping(value = "/ecommerce-goods-service/goods/deduct-goods-inventory",method = RequestMethod.POST)
    CommonResponse<Boolean> deductGoodsInventory(@RequestBody List<DeductGoodsInventory> deductGoodsInventories);

    /**
     * 根据ids查询简单商品信息
     * @param tableId
     * @return
     */
    @RequestMapping(value = "/ecommerce-goods-service/goods/simple-goods-info",method = RequestMethod.POST)
    CommonResponse<List<SimpleGoodsInfo>> getSimpleGoodsInfoByTableId(@RequestBody TableId tableId);
}
